package com.zhongba01.serviceribbon;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * 中巴价值投资研习社
 *
 * @author : tangjianhua
 * @date : 2018/7/24.
 */
@Service
public class HelloService {

    @Autowired
    RestTemplate restTemplate;

    @HystrixCommand(fallbackMethod = "serviceFailure")
    public String getHelloContent() {
        return restTemplate.getForObject("http://helloworld-service", String.class);
    }

    public String serviceFailure() {
        return "hello world service is not available !";
    }
}
